﻿namespace Snipps.Views
{
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Input;

    public partial class EditSnippetView : UserControl
    {
        public EditSnippetView()
        {
            InitializeComponent();
            btnSave.IsEnabledChanged += btnSave_IsEnabledChanged;
        }

        private void btnSave_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (!btnSave.IsEnabled && btnSave.IsFocused)
            {
                var tRequest = new TraversalRequest(FocusNavigationDirection.Next);
                btnSave.MoveFocus(tRequest);
            }
        }
    }
}